//
//  SCWishCommentFooterView.m
//  Mutal
//
//  Created by TonyStart on 16/10/28.
//  Copyright © 2016年 com.wx. All rights reserved.
//

#import "SCWishCommentFooterView.h"
#import "SCRewardViewController.h"
#import "UIView+SCGetViewController.h"
@interface SCWishCommentFooterView()
@property(nonatomic,strong)UIButton *rewardBtn;
@property(nonatomic,strong)UIButton *replyBtn;
@property(nonatomic,strong)UIButton *shareBtn;
@end
@implementation SCWishCommentFooterView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}
-(UIButton *)rewardBtn{
    if (!_rewardBtn) {
        _rewardBtn = [[UIButton alloc] initWithFrame:CGRectMake(20, 5, self.frame.size.width/2-10, self.frame.size.height-10)];
        _rewardBtn.layer.cornerRadius = 5;
        _rewardBtn.layer.masksToBounds = YES;
        [_rewardBtn setBackgroundColor:[UIColor colorWithRed:81/255.0 green:200/255.0 blue:195/255.0 alpha:1]];
        [_rewardBtn setTitle:@"打赏" forState:UIControlStateNormal];
        _rewardBtn.titleLabel.textAlignment = NSTextAlignmentCenter;
        [_rewardBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_rewardBtn setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted];
        _rewardBtn.tag = 1;
        [_rewardBtn addTarget:self action:@selector(BtnClick:) forControlEvents:UIControlEventTouchUpInside];
        
    }
    return _rewardBtn;
}
-(UIButton *)replyBtn{
    if (!_replyBtn) {
        _replyBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.frame.size.width - (self.frame.size.height-10)*2 - 40, 5, self.frame.size.height-10, self.frame.size.height-10)];
        _replyBtn.layer.cornerRadius = (self.frame.size.height-10)/2;
        _replyBtn.layer.masksToBounds = YES;
        _replyBtn.layer.borderWidth = 1;
        _replyBtn.layer.borderColor = [UIColor colorWithRed:81/255.0 green:200/255.0 blue:195/255.0 alpha:1].CGColor;
        [_replyBtn setImage:[UIImage imageNamed:@"icon-消息2"] forState:UIControlStateNormal];
        [_replyBtn setImage:[UIImage imageNamed:@"icon-消息"] forState:UIControlStateHighlighted];
        _replyBtn.tag = 2;
        [_replyBtn addTarget:self action:@selector(BtnClick:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _replyBtn;
}
-(UIButton *)shareBtn{
    if (!_shareBtn) {
        _shareBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.frame.size.width - (self.frame.size.height-10) - 20, 5, self.frame.size.height-10, self.frame.size.height-10)];
        _shareBtn.layer.cornerRadius = (self.frame.size.height-10)/2;
        _shareBtn.layer.masksToBounds = YES;
        _shareBtn.layer.borderWidth = 1;
        _shareBtn.layer.borderColor = [UIColor colorWithRed:81/255.0 green:200/255.0 blue:195/255.0 alpha:1].CGColor;
        [_shareBtn setImage:[UIImage imageNamed:@"icon-分享"] forState:UIControlStateNormal];
        [_shareBtn setImage:[UIImage imageNamed:@"icon-分享2"] forState:UIControlStateHighlighted];
        _shareBtn.tag = 3;
        [_shareBtn addTarget:self action:@selector(BtnClick:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _shareBtn;
}
-(void)setupUI{
    self.backgroundColor = [UIColor whiteColor];
    self.layer.borderColor = [UIColor grayColor].CGColor;
    self.layer.borderWidth = 1;
    [self addSubview:self.rewardBtn];
    [self addSubview:self.replyBtn];
    [self addSubview:self.shareBtn];
}
-(void)BtnClick:(UIButton*)sender{
    
    if (sender.tag == 1) {
        SCRewardViewController *rewardVC = [[SCRewardViewController alloc] init];
        
        [[self getCurrentVC].navigationController pushViewController:rewardVC animated:NO];
        
    }else if (sender.tag == 2){
        
    }else if (sender.tag == 3){
        
    }
    
    
}
@end
